<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="utf-8"%>
<html>
 <body>
 <%@ include file="dengluPublic.jsp" %>
 <%!
 String msgs;
 String fno;
 String cno;
 String id;
  %>
    <%
    request.setCharacterEncoding("utf-8");
    msgs=request.getParameter("msg");
    id=request.getParameter("id");
    fno=request.getParameter("fno");
    cno=request.getParameter("cno");
    
     %>
     <% String driverClass1="com.mysql.jdbc.Driver";
	    String url1="jdbc:mysql://localhost:3306/vote?useSSL=false";
	    String user1="root";
	    String password1="womenilu2580";
	    Class.forName(driverClass1);
	    Connection conn=DriverManager.getConnection(url1,user1,password1);	 
	    Statement stat=conn.createStatement();
	    String sql="select cno from t_customer where cname='"+customer.getCname()+"'";
	    ResultSet rs=stat.executeQuery(sql);
	    while(rs.next())
	    {
	    	cno=rs.getString("cno");
	    	System.out.println(msgs+","+id+",对方"+fno+",我方"+cno);
	    }
	    
	    Connection conn1=DriverManager.getConnection(url1,user1,password1);	 
	    Statement stat1=conn1.createStatement();
	    String sql1="insert into xiaoxi values('"+cno+"','"+fno+"','"+msgs+"')";
	    stat1.executeUpdate(sql1);
	    
	   %> 
    <%
    response.sendRedirect("sciencechat.jsp");
     %>
    
  </body>
</html>
